home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 8
/
QRZ Ham Radio Callsign Database - Volume 8.iso
/
mac
/
files
/
p_msys
/
msysb116.exe
/
SCAN440.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-12-05
|
5KB
|
172 lines
; scan440.asm
; Here is sample source for a Scan TSR to be used with the MSYS
; Pactor scan command
; This example is for the Kenwood TS-440. It may work for other
; Kenwood HF radios without modification. The TS-440 requires
; the following command format: CCxxxx;
; where CC is a two letter command name, xxxx is the parameters
; needed for the command and ; is a semicolon which terminates
; each command. To set the frequency on the TS-440, I send two
; commands: FN0; which tells the radio to use VFO A and the
; the frequency FA00014235000; which is a frequency of 14.235
; MHz. Note that the frequency must always be 11 digits for this
; radio.
; to produce the executable for this program, use the following
;
; asm scan440.asm {tasm or masm may be used}
; link scan440;
; exe2bin scan440 {makes .com file out of .exe file}
code segment
assume cs:code,ds:code
main proc far
org 0
segorg equ $
org 100h
start: jmp install
port dw 0 ;control uart base address
ten dw 10 ;divisor
thousand dw 1000
cmd db 'FN0;FA'
freq db 'GGMMMKKKHHH;',0
savequot dw 0
putser proc near
; send char in AL
push dx
push ax
mov dx,port
add dx,5 ;line status register
wait1: in al,dx
and al,20h ;check transmit holding reg
jz wait1 ;not ready yet
pop ax
mov dx,port
out dx,al ;send char to serial port
pop dx
ret
putser endp
putserstr proc near
; sends string pointed to by bx
push ax
push bx
psloop:
mov al, byte ptr [bx]
cmp al,0
je putserstrexit
call putser
inc bx
jmp psloop
putserstrexit:
pop bx
pop ax
ret
putserstr endp
handler:
STI ; enable interrupts
; ; If we don't we will get overruns
; ; on the serial ports for the tnc's
push ds ; save some registers
push ax
push ax ; save ax a second time
mov ax,cs
mov ds,ax ; set up ds
pop ax ; get back the ax we were called with
;
; upon entry, dx has port address
; ax has high order part of frequency
; bx has low order part of frequency
mov port,dx
; div divides DX:AX giving quot in AX, rem in DX
mov dx,ax
mov ax,bx
; We have a bit of a problem in that the DIV instruction
; requires that the quotient will fit in a 16 bit register.
; But a frequency like 14.350, which is 14350000 in the
; long (32 bit) variable and when divided by 10 the
; quotient won't fit in 16 bits (AX).
;
; So here is what we will do...
; First divide the original frequency by 1000. This will
; give a quotient <= 30000 which will fit.
; The remainder from this division will be run thru the
; divide by 10 to get the digits loop three times.
; Then we take the quotient and use the same instructions
; to do the other 8 required digits
div thousand ;rem in dx, quot in ax
mov savequot,ax
mov ax,dx ;set up for divide
sub dx,dx
mov cx,3 ;number of digits
mov bx,offset freq+10 ;place for first
dloop1:
div ten
add dl,'0' ;convert to ascii
mov byte ptr [bx],dl
sub dx,dx
dec bx
dec cx
cmp cx,0
jne dloop1
mov ax,savequot
sub dx,dx
mov cx,8
dloop2:
div ten
add dl,'0' ;convert to ascii
mov byte ptr [bx],dl
sub dx,dx
dec bx
dec cx
cmp cx,0
jne dloop2
xxx:
mov bx,offset cmd
call putserstr
pop ax
pop ds
iret
main endp
install:
mov dx,offset msg1
mov ah,9
int 21h
mov dx,offset handler
mov al,0D2h
mov ah,25h
int 21h
mov dx,(offset install - segorg +15) shr 4
mov ah,31h
int 21h
msg1 db 'Scan TSR loaded for Kenwood TS-440 using Int D2',13,10,'$'
code ends
end start